<?php
/**
* package: Asalsuri
* @author: Truong Kim Phung
* @date: January 22, 2014
*/
$strLocale	   = $this->session->userdata('locale') != '' ? $this->session->userdata('locale') : 'en'; // language default
$strController = $this->router->fetch_class(); // controller name
$strAction     = $this->router->fetch_method(); // action name
$AppUI	  	   = $this->session->userdata('admin'); // object admin "",syntax error, unexpected '}'
// set backurl
$this->redirect->admin($strController, $strAction);
/** 
* import file {controller}.header.php 
* import file language/{local}/common.php
* import file language/{locale}/{controller}.php
*/
$pathHeader			= APPPATH . 'admin/controllers/common/' . $strController . '.header.php';
$pathLanguageCom	= APPPATH  . '/language/' . $strLocale . '/common.php';	
$pathLanguage		= APPPATH  . '/language/' . $strLocale . '/' . $strController . '.php';	
if(file_exists($pathHeader)) {
    include_once($pathHeader);
	// import locale js
	if(isset($arrJS)) {		
		$pathLocale		= ROOT_DIR . '/data/upload/locale/' . $strLocale . '/' . $strController . '.js';	
		$linkLocale		= HOST_LOCALE . $strLocale . '/' . $strController . '.js';		
		if(file_exists($pathLocale)) array_unshift($arrJS, $linkLocale);
	}
}
if(file_exists($pathLanguageCom)) {
	include_once($pathLanguageCom);
}
if(file_exists($pathLanguage)) {
	include_once($pathLanguage);
}

$this->smarty->assign('AppUI', $AppUI);
$this->smarty->assign('strController', $strController);
$this->smarty->assign('strAction', $strAction);
$this->smarty->assign('strLocale', $strLocale);
// import file css
$this->smarty->assign('arrCSS', isset($arrCSS) ? $arrCSS : null );
// import file js
$this->smarty->assign('arrJS', isset($arrJS) ? $arrJS : null );
// get message
$this->smarty->assign('strMsg', CI_Function::getMsg());
// get error
$this->smarty->assign('strError', CI_Function::getError());
// smarty language
$this->smarty->assign('language', isset($arrSmarty) ? $arrSmarty : null);
// session permission